<?php
require_once('DataBase.php');

class SismoDB extends DataBase
{
	function SismoDB(){}

	function save(){
            
             
             $link = $this->connect();
           $sql = "INSERT INTO sismo (hash,fecha_sismo,intensidad,longitud,latitud,profundidad,cercania,servidor,pais)" .
            " VALUES('". $this->hash . "','" . $this->fecha . "'," . $this->intensidad . "," . $this->longitud . "," . $this->latitud . "," . $this->profundidad .
            ",'" . $this->cercania . "','" . $this->servidor . "','" . $this->pais . "')";
     $result = mysql_query($sql);
   
    $this->desconectarse($link);
        if($result) 
        return true;
        else return false;
        
           
	}
        
        function getSismo($server){
                $link = $this->connect();
		$sql="SELECT * FROM sismo WHERE servidor='$server' order by fecha_sismo desc;";
		$sismos=array();
		$index = mysql_query($sql);
		while($row = mysql_fetch_row($index)){
			$i=0;
			$sismos[] = new Sismo($row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++],$row[$i++]);
		}
		$this->desconectarse($link);
		return $sismos;
	}
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
